
#ifndef __H_SYMPHONY_COMMANDTABLE
#define __H_SYMPHONY_COMMANDTABLE

#include <string>
#include <vector>



class Command;
class Creature;



class CommandTable {
  private:
    std::string             _name;
    std::vector<Command*>   _commands;

  public:
    CommandTable( void );
    virtual ~CommandTable( void );

    void                      name( const std::string& name )                                           { _name = name; }
    std::string               name( void ) const                                                        { return _name; }
    std::vector<Command*>&    commands( void )                                                          { return _commands; }
    void                      add( Command* command, bool special = false );
    Command*                  find( std::string& name );
    virtual bool              execute( Creature* creature, Command* command, const std::string& args );
};

#define DEF_COMMANDTABLE(NAME)                                                              \
class NAME: public CommandTable {                                                           \
  public:                                                                                   \
    NAME( void );                                                                           \
    ~NAME( void ) { }                                                                       \
                                                                                            \
    static NAME&  Instance( void );                                                         \
};                                                                                          \
                                                                                            \
inline NAME& NAME::Instance( void ) {                                                       \
  static NAME instance;                                                                     \
  return instance;                                                                          \
}

DEF_COMMANDTABLE(Commands)        // Main Commands
DEF_COMMANDTABLE(AeditCommands)   // Aedit Commands
DEF_COMMANDTABLE(MeditCommands)   // Medit Commands
DEF_COMMANDTABLE(OeditCommands)   // Oedit Commands
DEF_COMMANDTABLE(PeditCommands)   // Pedit Commands
DEF_COMMANDTABLE(ReditCommands)   // Redit Commands
DEF_COMMANDTABLE(TeditCommands)   // Tedit Commands



#endif // #ifndef __H_SYMPHONY_COMMANDTABLE

